﻿// (c) Copyright slimCODE Software Inc. - www.slimcode.com
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using SlimCode.Windows.Controls.Mobile;

namespace SlimCode.SlimPasswords
{
  class ShowMoreView : ItemView
  {
    private List<PasswordItem> m_remainingItems;

    public ShowMoreView( List<PasswordItem> remainingItems )
      : base( 3 )
    {
      if( remainingItems == null )
        throw new ArgumentNullException( "remainingItems" );

      m_remainingItems = remainingItems;
    }

    public List<PasswordItem> RemainingItems
    {
      get { return m_remainingItems; }
    }

    protected override void DrawTopLayer( TemplatedPaintEventArgs e )
    {
      int baseUnit = this.LineHeight / 4;

      Rectangle rect = this.ClientRectangle;
      rect.Inflate( -baseUnit * 2, -baseUnit );

      e.StringFormat.Alignment = StringAlignment.Center;
      e.StringFormat.LineAlignment = StringAlignment.Near;
      e.StringFormat.FormatFlags = ( StringFormatFlags )0;

      e.Graphics.DrawString(
        "The remaining items are less relevant and were hidden for performance.",
        e.SmallFont,
        e.ForegroundBrush,
        rect, 
        e.StringFormat );

      e.StringFormat.LineAlignment = StringAlignment.Far;

      e.Graphics.DrawString(
        "Show more",
        e.BoldFont,
        e.ForegroundBrush,
        rect,
        e.StringFormat );
    }
  }
}
